package dao;

public class Factory {


    private static ChairDao chairDao = null;
    private static GroupDao groupDao = null;
    private static FacultyDao facultyDao = null;
    private static StudentDao studentDao = null;
    private static Factory instance = null;


    public static synchronized Factory getInstance(){
        if (instance == null){
            instance = new Factory();
        }
        return instance;
    }

    public ChairDao getChairDao(){
        if (chairDao == null){
            chairDao = new ChairDaoImpl();
        }
        return chairDao;
    }

    public GroupDao getGroupDao(){
        if (groupDao == null){
            groupDao = new GroupDaoImpl();
        }
        return groupDao;
    }

    public FacultyDao getFacultyDao(){
        if (facultyDao == null){
            facultyDao = new FacultyDaoImpl();
        }
        return facultyDao;
    }
    public StudentDao getStudentDao(){
        if (studentDao == null){
            studentDao = new StudentDaoImpl();
        }
        return studentDao;
    }

}
